home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / fortran / f2c_src.zip / F2C / DEFS.H < prev    next >
C/C++ Source or Header  |  1991-06-10  |  24KB  |  770 lines

  1. /****************************************************************
  2. Copyright 1990 by AT&T Bell Laboratories, Bellcore.
  3.  
  4. Permission to use, copy, modify, and distribute this software
  5. and its documentation for any purpose and without fee is hereby
  6. granted, provided that the above copyright notice appear in all
  7. copies and that both that the copyright notice and this
  8. permission notice and warranty disclaimer appear in supporting
  9. documentation, and that the names of AT&T Bell Laboratories or
  10. Bellcore or any of their entities not be used in advertising or
  11. publicity pertaining to distribution of the software without
  12. specific, written prior permission.
  13.  
  14. AT&T and Bellcore disclaim all warranties with regard to this
  15. software, including all implied warranties of merchantability
  16. and fitness.  In no event shall AT&T or Bellcore be liable for
  17. any special, indirect or consequential damages or any damages
  18. whatsoever resulting from loss of use, data or profits, whether
  19. in an action of contract, negligence or other tortious action,
  20. arising out of or in connection with the use or performance of
  21. this software.
  22. ****************************************************************/
  23.  
  24. #include "sysdep.h"
  25.  
  26. #include "ftypes.h"
  27. #include "defines.h"
  28. #include "machdefs.h"
  29.  
  30. #define MAXDIM 20
  31. #define MAXINCLUDES 10
  32. #define MAXLITERALS 200        /* Max number of constants in the literal
  33.                    pool */
  34. #define MAXTOKENLEN 302        /* length of longest token */
  35. #define MAXCTL 20
  36. #define MAXHASH 401
  37. #define MAXSTNO 801
  38. #define MAXEXT 200
  39. #define MAXEQUIV 150
  40. #define MAXLABLIST 125        /* Max number of labels in an alternate
  41.                    return CALL */
  42.  
  43. /* These are the primary pointer types used in the compiler */
  44.  
  45. typedef union Expression *expptr, *tagptr;
  46. typedef struct Chain *chainp;
  47. typedef struct Addrblock *Addrp;
  48. typedef struct Constblock *Constp;
  49. typedef struct Exprblock *Exprp;
  50. typedef struct Nameblock *Namep;
  51.  
  52. extern FILEP opf();
  53. extern FILEP infile;
  54. extern FILEP diagfile;
  55. extern FILEP textfile;
  56. extern FILEP asmfile;
  57. extern FILEP c_file;        /* output file for all functions; extern
  58.                    declarations will have to be prepended */
  59. extern FILEP pass1_file;    /* Temp file to hold the function bodies
  60.                    read on pass 1 */
  61. extern FILEP expr_file;        /* Debugging file */
  62. extern FILEP initfile;        /* Intermediate data file pointer */
  63. extern FILEP blkdfile;        /* BLOCK DATA file */
  64.  
  65. extern int current_ftn_file;
  66.  
  67. extern char *blkdfname, *initfname, *sortfname;
  68. extern long int headoffset;    /* Since the header block requires data we
  69.                    don't know about until AFTER each
  70.                    function has been processed, we keep a
  71.                    pointer to the current (dummy) header
  72.                    block (at the top of the assembly file)
  73.                    here */
  74.  
  75. extern char main_alias[];    /* name given to PROGRAM psuedo-op */
  76. extern char token [ ];
  77. extern int toklen;
  78. extern long lineno;
  79. extern char *infname;
  80. extern int needkwd;
  81. extern struct Labelblock *thislabel;
  82.  
  83. /* Used to allow runtime expansion of internal tables.  In particular,
  84.    these values can exceed their associated constants */
  85.  
  86. extern int maxctl;
  87. extern int maxequiv;
  88. extern int maxstno;
  89. extern int maxhash;
  90. extern int maxext;
  91.  
  92. extern flag nowarnflag;
  93. extern flag ftn66flag;        /* Generate warnings when weird f77
  94.                    features are used (undeclared dummy
  95.                    procedure, non-char initialized with
  96.                    string, 1-dim subscript in EQUIV) */
  97. extern flag no66flag;        /* Generate an error when a generic
  98.                    function (f77 feature) is used */
  99. extern flag noextflag;        /* Generate an error when an extension to
  100.                    Fortran 77 is used (hex/oct/bin
  101.                    constants, automatic, static, double
  102.                    complex types) */
  103. extern flag zflag;        /* enable double complex intrinsics */
  104. extern flag shiftcase;
  105. extern flag undeftype;
  106. extern flag shortsubs;        /* Use short subscripts on arrays? */
  107. extern flag onetripflag;    /* if true, always execute DO loop body */
  108. extern flag checksubs;
  109. extern flag debugflag;
  110. extern int nerr;
  111. extern int nwarn;
  112.  
  113. extern int parstate;
  114. extern flag headerdone;        /* True iff the current procedure's header
  115.                    data has been written */
  116. extern int blklevel;
  117. extern flag saveall;
  118. extern flag substars;        /* True iff some formal parameter is an
  119.                    asterisk */
  120. extern int impltype[ ];
  121. extern ftnint implleng[ ];
  122. extern int implstg[ ];
  123.  
  124. extern int tyint, tyioint, tyreal;
  125. extern int tylogical;        /* TY____ of the implementation of   logical.
  126.                    This will be LONG unless '-2' is given
  127.                    on the command line */
  128. extern int type_choice[];
  129. extern char *typename[];
  130.  
  131. extern int typesize[];    /* size (in bytes) of an object of each
  132.                    type.  Indexed by TY___ macros */
  133. extern int typealign[];
  134. extern int proctype;    /* Type of return value in this procedure */
  135. extern char * procname;    /* External name of the procedure, or last ENTRY name */
  136. extern int rtvlabel[ ];    /* Return value labels, indexed by TY___ macros */
  137. extern Addrp retslot;
  138. extern Addrp xretslot[];
  139. extern int cxslot;    /* Complex return argument slot (frame pointer offset)*/
  140. extern int chslot;    /* Character return argument slot (fp offset) */
  141. extern int chlgslot;    /* Argument slot for length of character buffer */
  142. extern int procclass;    /* Class of the current procedure:  either CLPROC,
  143.                CLMAIN, CLBLOCK or CLUNKNOWN */
  144. extern ftnint procleng;    /* Length of function return value (e.g. char
  145.                string length).  If this is -1, then the length is
  146.                not known at compile time */
  147. extern int nentry;    /* Number of entry points (other than the original
  148.                function call) into this procedure */
  149. extern flag multitype;    /* YES iff there is more than one return value
  150.                possible */
  151. extern int blklevel;
  152. extern long lastiolabno;
  153. extern int lastlabno;
  154. extern int lastvarno;
  155. extern int lastargslot;    /* integer offset pointing to the next free
  156.                location for an argument to the current routine */
  157. extern int argloc;
  158. extern int autonum[];        /* for numbering
  159.                    automatic variables, e.g. temporaries */
  160. extern int retlabel;
  161. extern int ret0label;
  162. extern int dorange;        /* Number of the label which terminates
  163.                    the innermost DO loop */
  164. extern int regnum[ ];        /* Numbers of DO indicies named in
  165.                    regnamep   (below) */
  166. extern Namep regnamep[ ];    /* List of DO indicies in registers */
  167. extern int maxregvar;        /* number of elts in   regnamep   */
  168. extern int highregvar;        /* keeps track of the highest register
  169.                    number used by DO index allocator */
  170. extern int nregvar;        /* count of DO indicies in registers */
  171.  
  172. extern chainp templist[];
  173. extern int maxdim;
  174. extern chainp earlylabs;
  175. extern chainp holdtemps;
  176. extern struct Entrypoint *entries;
  177. extern struct Rplblock *rpllist;
  178. extern struct Chain *curdtp;
  179. extern ftnint curdtelt;
  180. extern chainp allargs;        /* union of args in entries */
  181. extern int nallargs;        /* total number of args */
  182. extern int nallchargs;        /* total number of character args */
  183. extern flag toomanyinit;    /* True iff too many initializers in a
  184.                    DATA statement */
  185.  
  186. extern flag inioctl;
  187. extern int iostmt;
  188. extern Addrp ioblkp;
  189. extern int nioctl;
  190. extern int nequiv;
  191. extern int eqvstart;    /* offset to eqv number to guarantee uniqueness
  192.                and prevent <something> from going negative */
  193. extern int nintnames;
  194.  
  195. /* Chain of tagged blocks */
  196.  
  197. struct Chain
  198.     {
  199.     chainp nextp;
  200.     char * datap;        /* Tagged block */
  201.     };
  202.  
  203. extern chainp chains;
  204.  
  205. /* Recall that   field   is intended to hold four-bit characters */
  206.  
  207. /* This structure exists only to defeat the type checking */
  208.  
  209. struct Headblock
  210.     {
  211.     field tag;
  212.     field vtype;
  213.     field vclass;
  214.     field vstg;
  215.     expptr vleng;        /* Expression for length of char string -
  216.                    this may be a constant, or an argument
  217.                    generated by mkarg() */
  218.     } ;
  219.  
  220. /* Control construct info (for do loops, else, etc) */
  221.  
  222. struct Ctlframe
  223.     {
  224.     unsigned ctltype:8;
  225.     unsigned dostepsign:8;    /* 0 - variable, 1 - pos, 2 - neg */
  226.     unsigned dowhile:1;
  227.     int ctlabels[4];    /* Control labels, defined below */
  228.     int dolabel;        /* label marking end of this DO loop */
  229.     Namep donamep;        /* DO index variable */
  230.     expptr domax;        /* constan